<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <title>安珈毅'blog-爱心勇士QQ空间说说iPhone6 plus装逼神器</title>

    <!-- Sets initial viewport load and disables zooming  -->

    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

    <!-- SmartAddon.com Verification -->

    <meta name="smartaddon-verification" content="936e8d43184bc47ef34e25e426c508fe" />

    <!-- site css 文件夹里有备份 -->

    <link rel="stylesheet" href="http://iwemei.cn/css/site.min.css">



  </head>

  <body style="background-color: #f1f2f6;">

    <div class="container documents">
       <div class="row">
            <div class="col-sm-6 col-md-3">
              <div class="thumbnail">
<?php

/****************

*

**为你一人 wnyr.pw （原作者）

**斑马 iwemei.cn（修改 优化 美化）

*****************/

header("content-type:text/html; charset=utf-8");

if(!isset($_COOKIE['qq'])||!isset($_COOKIE['sid'])){
header("location: ./login.php");
exit;
}

$qq=$_COOKIE['qq'];
$sid=$_COOKIE['sid'];
$nickname=$_COOKIE['nickname'];

function cpost($url,$post){
	$ch= curl_init(); 
	curl_setopt($ch, CURLOPT_URL, $url);       
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn; R815T Build/JOP40D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/4.5 Mobile Safari/533.1'); 
	curl_setopt($ch, CURLOPT_AUTOREFERER, 1); 
	curl_setopt($ch, CURLOPT_POST, 1); 
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
	curl_setopt($ch, CURLOPT_TIMEOUT, 30); 
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$result = curl_exec($ch);
	curl_close($ch);
	return $result;
} 

function surl($content,$sid,$qq,$phone,$richval,$lon="",$lat=""){
	$url='http://m.qzone.com/mood/publish_mood';
	$post='content='.$content.'++&sid='.$sid.'&lon='.$lon.'&lbsid=&res_uin='.$qq.'&richval='.urlencode($richval).'&source_name='.$phone.'&is_winphone=2&opr_type=publish_shuoshuo&format=json&issyncweibo=0&lat='.$lat;
	return cpost($url,$post);
}



echo <<<HTML

<html>

<body>
<br>
<form action="./index.php" method="post" enctype="multipart/form-data">
            <ul class="media-list">
              <li class="media">
                <p class="pull-left"><img class="media-object img-rounded" src="http://q1.qlogo.cn/g?b=qq&nk={$qq}&s=100" width="80" height="80" style="border-radius:50%"></p>
                <div class="media-body">
                  <h3 class="media-heading">{$nickname}</h3>
                  <p>{$qq}</p>
                  <p>


内容：<br>
                <textarea name="content" class="form-control" rows="3"></textarea><br>

机型：<br>
<input type="text" class="form-control" name="phone" value="iPhone 6 Plus"><br>

<label for="file">添加图片：</label><br>

<input type="file" class="form-control" name="file" id="file" /> 

<br />

<input type="submit" class="btn btn-success btn-block" name="submit" value="发表" />
</p>
</li>
</ul>
</form>

</body>

</html>

HTML;


        $phone=$_POST["phone"];

        $content=$_POST["content"];



if($_POST["submit"]){
	$file = realpath($_FILES["file"]["tmp_name"]);
	$image_size = getimagesize($file); 
	$image=file_get_contents($file);
	$url="http://up.qzone.com/cgi-bin/upload/cgi_upload_pic_v2";
	$post="picture=".urlencode(base64_encode($image))."&base64=1&hd_height=".$image_size[1]."&hd_width=".$image_size[0]."&hd_quality=90&output_type=json&preupload=1&charset=utf-8&output_charset=utf-8&logintype=sid&Exif_CameraMaker=&Exif_CameraModel=&Exif_Time=&uin=".$qq."&sid=".$sid;
	$data=preg_replace("/\s/","",cpost($url,$post));
	preg_match('/_Callback\((.*)\);/',$data,$arr);
	$data=json_decode($arr[1],true);
	$post="output_type=json&preupload=2&md5=".$data[filemd5]."&filelen=".$data[filelen]."&batchid=".time().rand(100000,999999)."&currnum=0&uploadNum=1&uploadtime=".time()."&uploadtype=1&upload_hd=0&albumtype=7&big_style=1&op_src=15003&charset=utf-8&output_charset=utf-8&uin=".$qq."&sid=".$sid."&logintype=sid&refer=shuoshuo";
	$img=preg_replace("/\s/","",cpost($url,$post));
	preg_match('/_Callback\(\[(.*)\]\);/',$img,$arr);
	$data=json_decode($arr[1],true);
	$richval=($data[picinfo][albumid]!="")?"{$data[picinfo][albumid]},{$data[picinfo][lloc]},{$data[picinfo][sloc]},{$data[picinfo][type]},{$data[picinfo][height]},{$data[picinfo][width]},,,":"";
	$result=surl($content,$sid,$qq,$phone,$richval,$lon,$lat);
	$result=json_decode($result,true);
	if($result[code]==0) echo '        <div class="row">
          <div class="col-md-6">
            <div class="alert alert-success alert-dismissable">

              <strong>发表成功</strong>
</div>
</div>
</div>';

	else echo '        <div class="row">
          <div class="col-md-6">
            <div class="alert alert-warning alert-dismissable">

              <strong>发表失败，请退出登录重试！</strong>
</div>
</div>
</div>';
}
?>
</div>
</div>
</div>
<a href="./login.php?action=logout" class="btn btn-danger btn-block">退出登录</a><br>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?64847e1f2c327ac1c8e6324c6bce85b9";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</div>
</body>
</html>